// 发票管理
import expandRow from './table-expand.vue'
export const InvoiceManageThead = [
  {
    type: 'selection',
    width: 60,
    align: 'center',
    fixed: 'left',
  },
  {
    title: '开票渠道',
    key: 'invoiceChannel',
    minWidth: 100,
    fixed: 'left',
    render: (h, params) => {
      const text = params.row.invoiceChannel == 0 ? '账单开票' : params.row.invoiceChannel == 1 ? '即时开票' : '红字发票'
      return h('span', text)
    }
  },
  // {
  //   title: '集团公司',
  //   key: 'parentName',
  //   minWidth: 160,
  //   fixed: 'left',
  //   // render: (h, params) => {
  //   //   const text = params.row.invoiceChannel == 0 ? params.row.parentName : params.row.companyName
  //   //   return h('span', text)
  //   // }
  //   render: (h, params) => {
  //     return h('div', [
  //        h('span', {
  //            style: {
  //                display: 'inline-block',
  //                width: '100%',
  //                overflow: 'hidden',
  //                textOverflow: 'ellipsis',
  //                whiteSpace: 'nowrap'
  //            },
  //            domProps: {
  //                title: params.row.parentName
  //            }
  //        }, params.row.parentName)
  //    ]); 
  //  }
  // },
  {
    title: '客户名称',
    key: 'companyName',
    minWidth: 120,
    fixed: 'left',
    // render: (h, params) => {
    //   const text = params.row.companyName.length > 12 ? params.row.companyName.slice(0,11)+'...' : params.row.companyName
    //   return h('span', text)
    // }
    render: (h, params) => {
      return h('div', [
         h('span', {
             style: {
                 display: 'inline-block',
                 width: '100%',
                 overflow: 'hidden',
                 textOverflow: 'ellipsis',
                 whiteSpace: 'nowrap'
             },
             domProps: {
                 title: params.row.companyName
             }
         }, params.row.companyName)
     ]); 
   }
  },

  {
    title: '发票类型',
    key: 'invoiceType',
    minWidth:150,
  },

  // {
  //   title: '客户名称',
  //   key: 'companyName',
  //   minWidth: 240
  // },
  {
    title: '费用月份',
    key: 'periodYear',
    minWidth: 150,
    render: (h, params) => {
      const month = params.row.periodMonth < 10 ? '0' + params.row.periodMonth : params.row.periodMonth
      const text = params.row.periodYear + '' + month
      return h('span', text)
    }
  },
  {
    title: '账单金额',
    key: 'billAmt',
    minWidth: 150
  },
  {
    title: '开票金额',
    key: 'totalAmt',
    minWidth: 150
  },
  {
    title: '剩余开票金额',
    key: 'restAmt',
    minWidth: 150
  },
  {
    title: '申请人',
    key: 'applyUserName',
    minWidth: 150
  },
  {
    title: '申请时间',
    key: 'applyTime',
    minWidth: 180
  },
  {
    title: '开票人',
    key: 'doUserName',
    minWidth: 150
  },
  {
    title: '开票时间',
    key: 'doTime',
    minWidth: 150
  },
  {
    title: '开票说明',
    key: 'remark',
    minWidth: 150
  },
  {
    title: '发票号码',
    key: 'invoiceNo',
    minWidth: 150
  },
  {
    title: '开票状态',
    key: 'statusRemark',
    minWidth: 150
  },
  {
    title: '操作',
    width: 120,
    align: 'center',
    key: 'action',
    slot: 'action',
    fixed: 'right'
  },
  {
    title: '',
    type: 'expand',
    key: 'expand',
    // slot: 'action',
    fixed: 'right',
    minWidth: 20,
    render: (h, params) => {
      return h(expandRow, {
        props: {
          row: params.row
        }
      })
    }
  }
]

export const InvoiceManageChildThead = [
  {
    title: '客户名称',
    key: 'companyName'
  },
  {
    title: '客服',
    key: 'serverName'
  },
  {
    title: '账单金额',
    key: 'billAmt'
  },
]

// 开票申请
export const InvoiceApplyThead = [
  {
    title: '产品明细',
    key: 'productDetail',
    minWidth: 160
  },
  {
    title: '账单金额',
    key: 'billAmt',
    minWidth: 120
  },
  {
    title: '税率',
    key: 'taxRate',
    minWidth: 120
  },
  {
    title: '税目(选)',
    key: 'invoiceTaxName',
    minWidth: 160,
    slot: 'invoiceTaxName'
  },
  {
    title: '开票金额(输 小于等于账单金额)',
    key: 'amt',
    minWidth: 120,
    slot: 'amt'
  },
  {
    title: '剩余开票金额(账单金额-开票金额)',
    key: 'restAmt',
    minWidth: 120
  },
]
